package com.esp.studentManagementSystem.service.impl;

import com.esp.studentManagementSystem.pojo.bo.UserBO;
import com.esp.studentManagementSystem.pojo.po.entity.SysUser;
import com.esp.studentManagementSystem.repository.UserRepository;
import com.esp.studentManagementSystem.service.UserBOService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserBOServiceImpl implements UserBOService {
    @Autowired
    private UserRepository userRepository;

    @Override
    public UserBO getSysUserByUsername(String username) {
        SysUser sysUser = userRepository.getSysUserByUsername(username);
        UserBO userBO = new UserBO();
        userBO.setUserId(sysUser.getUserId());
        userBO.setUsername(sysUser.getUsername());
        userBO.setPassword(sysUser.getPassword());
        userBO.setSex(sysUser.getSex());
        userBO.setAddress(sysUser.getAddress());
        userBO.setEnabled(sysUser.getEnabled());
        userBO.setAccountNoExpired(sysUser.getAccountNotExpired());
        userBO.setCredentialsNoExpired(sysUser.getCredentialsNotExpired());
        userBO.setAccountNoLocked(sysUser.getAccountNotLocked());
        return userBO;
    }
}

